Optimal. Leaf size=325 \[ \frac {1}{16} \left (32 a^3 A b+24 a A b^3+8 a^4 B+36 a^2 b^2 B+5 b^4 B\right ) x+\frac {\left (24 a^4 A b+224 a^2 A b^3+32 A b^5-4 a^5 B+121 a^3 b^2 B+128 a b^4 B\right ) \sin (c+d x)}{60 b d}+\frac {\left (48 a^3 A b+232 a A b^3-8 a^4 B+178 a^2 b^2 B+75 b^4 B\right ) \cos (c+d x) \sin (c+d x)}{240 d}+\frac {\left (24 a^2 A b+32 A b^3-4 a^3 B+53 a b^2 B\right ) (a+b \cos (c+d x))^2 \sin (c+d x)}{120 b d}+\frac {\left (24 a A b-4 a^2 B+25 b^2 B\right ) (a+b \cos (c+d x))^3 \sin (c+d x)}{120 b d}+\frac {(6 A b-a B) (a+b \cos (c+d x))^4 \sin (c+d x)}{30 b d}+\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.33, antiderivative size = 325, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 4, integrand size = 29, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.138, Rules used = {3047, 3102,
2832, 2813} \begin {gather*} \frac {\left (-4 a^2 B+24 a A b+25 b^2 B\right ) \sin (c+d x) (a+b \cos (c+d x))^3}{120 b d}+\frac {\left (-4 a^3 B+24 a^2 A b+53 a b^2 B+32 A b^3\right ) \sin (c+d x) (a+b \cos (c+d x))^2}{120 b d}+\frac {\left (-8 a^4 B+48 a^3 A b+178 a^2 b^2 B+232 a A b^3+75 b^4 B\right ) \sin (c+d x) \cos (c+d x)}{240 d}+\frac {1}{16} x \left (8 a^4 B+32 a^3 A b+36 a^2 b^2 B+24 a A b^3+5 b^4 B\right )+\frac {\left (-4 a^5 B+24 a^4 A b+121 a^3 b^2 B+224 a^2 A b^3+128 a b^4 B+32 A b^5\right ) \sin (c+d x)}{60 b d}+\frac {(6 A b-a B) \sin (c+d x) (a+b \cos (c+d x))^4}{30 b d}+\frac {B \sin (c+d x) (a+b \cos (c+d x))^5}{6 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2813
Rule 2832
Rule 3047
Rule 3102
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \cos (c+d x))^4 (A+B \cos (c+d x)) \, dx &=\int (a+b \cos (c+d x))^4 \left (A \cos (c+d x)+B \cos ^2(c+d x)\right ) \, dx\\ &=\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d}+\frac {\int (a+b \cos (c+d x))^4 (5 b B+(6 A b-a B) \cos (c+d x)) \, dx}{6 b}\\ &=\frac {(6 A b-a B) (a+b \cos (c+d x))^4 \sin (c+d x)}{30 b d}+\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d}+\frac {\int (a+b \cos (c+d x))^3 \left (3 b (8 A b+7 a B)+\left (24 a A b-4 a^2 B+25 b^2 B\right ) \cos (c+d x)\right ) \, dx}{30 b}\\ &=\frac {\left (24 a A b-4 a^2 B+25 b^2 B\right ) (a+b \cos (c+d x))^3 \sin (c+d x)}{120 b d}+\frac {(6 A b-a B) (a+b \cos (c+d x))^4 \sin (c+d x)}{30 b d}+\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d}+\frac {\int (a+b \cos (c+d x))^2 \left (3 b \left (56 a A b+24 a^2 B+25 b^2 B\right )+3 \left (24 a^2 A b+32 A b^3-4 a^3 B+53 a b^2 B\right ) \cos (c+d x)\right ) \, dx}{120 b}\\ &=\frac {\left (24 a^2 A b+32 A b^3-4 a^3 B+53 a b^2 B\right ) (a+b \cos (c+d x))^2 \sin (c+d x)}{120 b d}+\frac {\left (24 a A b-4 a^2 B+25 b^2 B\right ) (a+b \cos (c+d x))^3 \sin (c+d x)}{120 b d}+\frac {(6 A b-a B) (a+b \cos (c+d x))^4 \sin (c+d x)}{30 b d}+\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d}+\frac {\int (a+b \cos (c+d x)) \left (3 b \left (216 a^2 A b+64 A b^3+64 a^3 B+181 a b^2 B\right )+3 \left (48 a^3 A b+232 a A b^3-8 a^4 B+178 a^2 b^2 B+75 b^4 B\right ) \cos (c+d x)\right ) \, dx}{360 b}\\ &=\frac {1}{16} \left (32 a^3 A b+24 a A b^3+8 a^4 B+36 a^2 b^2 B+5 b^4 B\right ) x+\frac {\left (24 a^4 A b+224 a^2 A b^3+32 A b^5-4 a^5 B+121 a^3 b^2 B+128 a b^4 B\right ) \sin (c+d x)}{60 b d}+\frac {\left (48 a^3 A b+232 a A b^3-8 a^4 B+178 a^2 b^2 B+75 b^4 B\right ) \cos (c+d x) \sin (c+d x)}{240 d}+\frac {\left (24 a^2 A b+32 A b^3-4 a^3 B+53 a b^2 B\right ) (a+b \cos (c+d x))^2 \sin (c+d x)}{120 b d}+\frac {\left (24 a A b-4 a^2 B+25 b^2 B\right ) (a+b \cos (c+d x))^3 \sin (c+d x)}{120 b d}+\frac {(6 A b-a B) (a+b \cos (c+d x))^4 \sin (c+d x)}{30 b d}+\frac {B (a+b \cos (c+d x))^5 \sin (c+d x)}{6 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.75, size = 333, normalized size = 1.02 \begin {gather*} \frac {1920 a^3 A b c+1440 a A b^3 c+480 a^4 B c+2160 a^2 b^2 B c+300 b^4 B c+1920 a^3 A b d x+1440 a A b^3 d x+480 a^4 B d x+2160 a^2 b^2 B d x+300 b^4 B d x+120 \left (8 a^4 A+36 a^2 A b^2+5 A b^4+24 a^3 b B+20 a b^3 B\right ) \sin (c+d x)+15 \left (64 a^3 A b+64 a A b^3+16 a^4 B+96 a^2 b^2 B+15 b^4 B\right ) \sin (2 (c+d x))+480 a^2 A b^2 \sin (3 (c+d x))+100 A b^4 \sin (3 (c+d x))+320 a^3 b B \sin (3 (c+d x))+400 a b^3 B \sin (3 (c+d x))+120 a A b^3 \sin (4 (c+d x))+180 a^2 b^2 B \sin (4 (c+d x))+45 b^4 B \sin (4 (c+d x))+12 A b^4 \sin (5 (c+d x))+48 a b^3 B \sin (5 (c+d x))+5 b^4 B \sin (6 (c+d x))}{960 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.22, size = 316, normalized size = 0.97 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.29, size = 307, normalized size = 0.94 \begin {gather*} \frac {240 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{4} + 960 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a^{3} b - 1280 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a^{3} b - 1920 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A a^{2} b^{2} + 180 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B a^{2} b^{2} + 120 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} A a b^{3} + 256 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} B a b^{3} + 64 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} A b^{4} - 5 \, {\left (4 \, \sin \left (2 \, d x + 2 \, c\right )^{3} - 60 \, d x - 60 \, c - 9 \, \sin \left (4 \, d x + 4 \, c\right ) - 48 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B b^{4} + 960 \, A a^{4} \sin \left (d x + c\right )}{960 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.39, size = 243, normalized size = 0.75 \begin {gather*} \frac {15 \, {\left (8 \, B a^{4} + 32 \, A a^{3} b + 36 \, B a^{2} b^{2} + 24 \, A a b^{3} + 5 \, B b^{4}\right )} d x + {\left (40 \, B b^{4} \cos \left (d x + c\right )^{5} + 240 \, A a^{4} + 640 \, B a^{3} b + 960 \, A a^{2} b^{2} + 512 \, B a b^{3} + 128 \, A b^{4} + 48 \, {\left (4 \, B a b^{3} + A b^{4}\right )} \cos \left (d x + c\right )^{4} + 10 \, {\left (36 \, B a^{2} b^{2} + 24 \, A a b^{3} + 5 \, B b^{4}\right )} \cos \left (d x + c\right )^{3} + 32 \, {\left (10 \, B a^{3} b + 15 \, A a^{2} b^{2} + 8 \, B a b^{3} + 2 \, A b^{4}\right )} \cos \left (d x + c\right )^{2} + 15 \, {\left (8 \, B a^{4} + 32 \, A a^{3} b + 36 \, B a^{2} b^{2} + 24 \, A a b^{3} + 5 \, B b^{4}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{240 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [B] Leaf count of result is larger than twice the leaf count of optimal. 811 vs.
\(2 (335) = 670\).
time = 0.56, size = 811, normalized size = 2.50 \begin {gather*} \begin {cases} \frac {A a^{4} \sin {\left (c + d x \right )}}{d} + 2 A a^{3} b x \sin ^{2}{\left (c + d x \right )} + 2 A a^{3} b x \cos ^{2}{\left (c + d x \right )} + \frac {2 A a^{3} b \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{d} + \frac {4 A a^{2} b^{2} \sin ^{3}{\left (c + d x \right )}}{d} + \frac {6 A a^{2} b^{2} \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 A a b^{3} x \sin ^{4}{\left (c + d x \right )}}{2} + 3 A a b^{3} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )} + \frac {3 A a b^{3} x \cos ^{4}{\left (c + d x \right )}}{2} + \frac {3 A a b^{3} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {5 A a b^{3} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{2 d} + \frac {8 A b^{4} \sin ^{5}{\left (c + d x \right )}}{15 d} + \frac {4 A b^{4} \sin ^{3}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{3 d} + \frac {A b^{4} \sin {\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{d} + \frac {B a^{4} x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{4} x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {B a^{4} \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {8 B a^{3} b \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {4 B a^{3} b \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {9 B a^{2} b^{2} x \sin ^{4}{\left (c + d x \right )}}{4} + \frac {9 B a^{2} b^{2} x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{2} + \frac {9 B a^{2} b^{2} x \cos ^{4}{\left (c + d x \right )}}{4} + \frac {9 B a^{2} b^{2} \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{4 d} + \frac {15 B a^{2} b^{2} \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{4 d} + \frac {32 B a b^{3} \sin ^{5}{\left (c + d x \right )}}{15 d} + \frac {16 B a b^{3} \sin ^{3}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{3 d} + \frac {4 B a b^{3} \sin {\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{d} + \frac {5 B b^{4} x \sin ^{6}{\left (c + d x \right )}}{16} + \frac {15 B b^{4} x \sin ^{4}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{16} + \frac {15 B b^{4} x \sin ^{2}{\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{16} + \frac {5 B b^{4} x \cos ^{6}{\left (c + d x \right )}}{16} + \frac {5 B b^{4} \sin ^{5}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{16 d} + \frac {5 B b^{4} \sin ^{3}{\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{6 d} + \frac {11 B b^{4} \sin {\left (c + d x \right )} \cos ^{5}{\left (c + d x \right )}}{16 d} & \text {for}\: d \neq 0 \\x \left (A + B \cos {\left (c \right )}\right ) \left (a + b \cos {\left (c \right )}\right )^{4} \cos {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.47, size = 263, normalized size = 0.81 \begin {gather*} \frac {B b^{4} \sin \left (6 \, d x + 6 \, c\right )}{192 \, d} + \frac {1}{16} \, {\left (8 \, B a^{4} + 32 \, A a^{3} b + 36 \, B a^{2} b^{2} + 24 \, A a b^{3} + 5 \, B b^{4}\right )} x + \frac {{\left (4 \, B a b^{3} + A b^{4}\right )} \sin \left (5 \, d x + 5 \, c\right )}{80 \, d} + \frac {{\left (12 \, B a^{2} b^{2} + 8 \, A a b^{3} + 3 \, B b^{4}\right )} \sin \left (4 \, d x + 4 \, c\right )}{64 \, d} + \frac {{\left (16 \, B a^{3} b + 24 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} \sin \left (3 \, d x + 3 \, c\right )}{48 \, d} + \frac {{\left (16 \, B a^{4} + 64 \, A a^{3} b + 96 \, B a^{2} b^{2} + 64 \, A a b^{3} + 15 \, B b^{4}\right )} \sin \left (2 \, d x + 2 \, c\right )}{64 \, d} + \frac {{\left (8 \, A a^{4} + 24 \, B a^{3} b + 36 \, A a^{2} b^{2} + 20 \, B a b^{3} + 5 \, A b^{4}\right )} \sin \left (d x + c\right )}{8 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 1.37, size = 403, normalized size = 1.24 \begin {gather*} \frac {B\,a^4\,x}{2}+\frac {5\,B\,b^4\,x}{16}+\frac {3\,A\,a\,b^3\,x}{2}+2\,A\,a^3\,b\,x+\frac {A\,a^4\,\sin \left (c+d\,x\right )}{d}+\frac {5\,A\,b^4\,\sin \left (c+d\,x\right )}{8\,d}+\frac {9\,B\,a^2\,b^2\,x}{4}+\frac {B\,a^4\,\sin \left (2\,c+2\,d\,x\right )}{4\,d}+\frac {5\,A\,b^4\,\sin \left (3\,c+3\,d\,x\right )}{48\,d}+\frac {A\,b^4\,\sin \left (5\,c+5\,d\,x\right )}{80\,d}+\frac {15\,B\,b^4\,\sin \left (2\,c+2\,d\,x\right )}{64\,d}+\frac {3\,B\,b^4\,\sin \left (4\,c+4\,d\,x\right )}{64\,d}+\frac {B\,b^4\,\sin \left (6\,c+6\,d\,x\right )}{192\,d}+\frac {A\,a\,b^3\,\sin \left (2\,c+2\,d\,x\right )}{d}+\frac {A\,a^3\,b\,\sin \left (2\,c+2\,d\,x\right )}{d}+\frac {A\,a\,b^3\,\sin \left (4\,c+4\,d\,x\right )}{8\,d}+\frac {9\,A\,a^2\,b^2\,\sin \left (c+d\,x\right )}{2\,d}+\frac {5\,B\,a\,b^3\,\sin \left (3\,c+3\,d\,x\right )}{12\,d}+\frac {B\,a^3\,b\,\sin \left (3\,c+3\,d\,x\right )}{3\,d}+\frac {B\,a\,b^3\,\sin \left (5\,c+5\,d\,x\right )}{20\,d}+\frac {A\,a^2\,b^2\,\sin \left (3\,c+3\,d\,x\right )}{2\,d}+\frac {3\,B\,a^2\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2\,d}+\frac {3\,B\,a^2\,b^2\,\sin \left (4\,c+4\,d\,x\right )}{16\,d}+\frac {5\,B\,a\,b^3\,\sin \left (c+d\,x\right )}{2\,d}+\frac {3\,B\,a^3\,b\,\sin \left (c+d\,x\right )}{d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________